<?php

declare (strict_types=1);
namespace App\Model;

/**
 * @property int $id 
 * @property int $order_id 
 * @property int $order_type 
 * @property int $shop_id 
 * @property int $user_id 
 * @property int $shop_is_read 
 * @property int $user_is_read 
 * @property \Carbon\Carbon $user_read_time
 * @property \Carbon\Carbon $shop_read_time
 * @property \Carbon\Carbon $created_at
 */
class FlyExpressTipsLog extends Model
{
    /**
     * @var bool|boolean
     */
    public $timestamps = false;
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'fly_express_tips_log';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'string', 'order_id' => 'string', 'order_type' => 'integer', 'shop_id' => 'string', 'user_id' => 'string', 'shop_is_read' => 'integer', 'user_is_read' => 'integer', 'created_at' => 'datetime'];

    public function order_info(){

        return $this
            ->belongsTo(FlyOrder::class,'order_id','order_id')
            ->with('with_products')
            ->with('with_current_af')
            ->with('with_shop')
            ;
    }

    public function getCreatedAtAttribute($value)
    {
        return strtotime($value);
    }
}